import request from '@/router/axios';

/**
 * 生成序列号
 */
export const createSequence = (data) => {
  return request({
    url: '/api/mes-admin/label-product/normal-outsn',
    method: 'post',
    data: data
  });
};

/**
 * 根据工单id查询生成记录
 */
export const getSourceListByWorkOrderId = (params) => {
  return request({
    url: '/api/mes-admin/sequence/generation/source',
    method: 'get',
    params: params
  });
};

/**
 * 无工单查询生成记录
 */
export const getSourceList = (params) => {
  return request({
    url: '/api/mes-admin/sequence/generation/page/sequencenumber-or-sourcetype',
    method: 'get',
    params: params
  });
};

/**
 * 序列号标签打印
 */
export const sequencePrint = (data) => {
  return request({
    url: '/api/mes-admin/label-product/print-outsn',
    method: 'post',
    data: data
  });
};

/**
 * 查询起始/结束流水号
 */
export const sequenceGenerationSum = (data) => {
  return request({
    url: '/api/mes-admin/sequence/generation/sum',
    method: 'get',
    params: data
  });
};

// 打印测试
export const printTest = (row) => {
  return request({
    url: 'api/mes-admin/api/print/test',
    method: 'post',
    data: row
  });
};

/**
 * 产品序列号打印
 * @param {*} data
 * @returns
 */
export const snPrint = (data) => {
  return request({
    url: '/api/mes-admin/label-product/duplicate-print-outSn',
    method: 'get',
    params: { ...data }
  });
};

/**
 * 无工单标签打印
 */
export const snPrintNoWorkOrder = (data) => {
  return request({
    url: '/api/mes-admin/api/print/label/withoutDynamicData',
    method: 'post',
    data: data
  });
};
